import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";

// https://vitejs.dev/config/
export default defineConfig({
  server: {
    port: 8888,
    proxy: {
      "^/api": {
        target: "http://localhost:2703",
        changeOrigin: true, //是否跨域
        // rewrite: (path) => path.replace(/^\/api/, ""), //重写路径
      },
    },
  },
  plugins: [
    vue(),
    // AutoImport({
    //   imports: ["vue", "vue-router", "pinia"],
    // }),
    Components({
      resolvers: [
        AntDesignVueResolver({
          importStyle: false, // css in js
        }),
      ],
    }),
  ],
  resolve: {
    extensions: [".js", ".vue"],
  },
});
